import request from '@/utils/request'

const prefixUrl = 'web/mission/'

// 我发起的任务列表
export function my_send_list(params) {
  return request({
    url: prefixUrl + 'my_list',
    method: 'get',
    params: params
  })
}

// 我的待办任务列表
export function my_receive_list(params) {
  return request({
    url: prefixUrl + 'todo_list',
    method: 'get',
    params: params
  })
}

// 新增任务
export function addMission(data) {
  return request({
    url: prefixUrl + 'add',
    method: 'post',
    data: data,
    content_type: 'json'
  })
}

// 编辑任务
export function editMission(data) {
  return request({
    url: prefixUrl + 'edit',
    method: 'post',
    data: data,
    content_type: 'json'
  })
}

// 关闭任务
export function offMission(ids) {
  return request({
    url: prefixUrl + 'off',
    method: 'put',
    params: {
      ids: ids
    }
  })
}

// 完成任务
export function completeMission(ids) {
  return request({
    url: prefixUrl + 'complete',
    method: 'put',
    params: {
      ids: ids
    }
  })
}

// 执行者完成任务
export function operatorCompleteMission(ids, complete_memo) {
  return request({
    url: prefixUrl + 'operator_complete',
    method: 'put',
    params: {
      ids: ids,
      complete_memo: complete_memo
    }
  })
}

// 删除任务
export function deleteMission(ids) {
  return request({
    url: prefixUrl + 'delete',
    method: 'put',
    params: {
      ids: ids
    }
  })
}
